package com.htc.android.footprints.commonui;

import android.content.Context;
import android.util.AttributeSet;
import android.widget.Checkable;
import android.widget.ImageView;

public class SwitchButton extends ImageView
  implements Checkable
{
  private static final int[] CHECKED_STATE_SET;
  private boolean mChecked;
  private OnCheckedChangeListener mOnCheckedChangeListener;

  static
  {
    int[] arrayOfInt = new int[1];
    arrayOfInt[0] = 16842912;
    CHECKED_STATE_SET = arrayOfInt;
  }

  public SwitchButton(Context paramContext)
  {
    super(paramContext);
    initView();
  }

  public SwitchButton(Context paramContext, AttributeSet paramAttributeSet)
  {
    super(paramContext, paramAttributeSet, 0);
    initView();
  }

  public SwitchButton(Context paramContext, AttributeSet paramAttributeSet, int paramInt)
  {
    super(paramContext, paramAttributeSet, paramInt);
    initView();
  }

  private void initView()
  {
    setClickable(true);
  }

  public boolean isChecked()
  {
    return this.mChecked;
  }

  public int[] onCreateDrawableState(int paramInt)
  {
    int[] arrayOfInt = super.onCreateDrawableState(paramInt + 1);
    if (isChecked())
      mergeDrawableStates(arrayOfInt, CHECKED_STATE_SET);
    return arrayOfInt;
  }

  public boolean performClick()
  {
    toggle();
    return super.performClick();
  }

  public void setChecked(boolean paramBoolean)
  {
    if (this.mChecked != paramBoolean)
    {
      this.mChecked = paramBoolean;
      refreshDrawableState();
      if (this.mOnCheckedChangeListener != null)
        this.mOnCheckedChangeListener.onCheckedChanged(this, this.mChecked);
    }
  }

  public void setOnCheckedChangeListener(OnCheckedChangeListener paramOnCheckedChangeListener)
  {
    this.mOnCheckedChangeListener = paramOnCheckedChangeListener;
  }

  public void toggle()
  {
    if (!this.mChecked);
    for (boolean bool = true; ; bool = false)
    {
      setChecked(bool);
      return;
    }
  }

  public static abstract interface OnCheckedChangeListener
  {
    public abstract void onCheckedChanged(SwitchButton paramSwitchButton, boolean paramBoolean);
  }
}

/* Location:           E:\workspace\dex2java\dex-translator-0.0.9.3\HtcFootprints_dex2jar.jar
 * Qualified Name:     com.htc.android.footprints.commonui.SwitchButton
 * JD-Core Version:    0.6.0
 */